var a = getApp();

Page({
    data: {
        canWidth: "",
        canHeight: ""
    },
    onLoad: function(a) {
        var t = this;
        wx.setNavigationBarTitle({
            title: "奖金池"
        }), wx.getSystemInfo({
            success: function(a) {
                t.setData({
                    canWidth: a.windowWidth,
                    canHeight: a.windowHeight
                });
            }
        }), this.getData();
    },
    getData: function() {
        var t = this, n = a.getNetAddresss("plugin.prize-pool.frontend.controllers.center");
        a._getNetWork({
            url: n,
            data: {},
            success: function(a) {
                1 === a.data.result ? t.setData({
                    info: a.data.data
                }) : wx.showToast({
                    title: a.data.msg
                });
            }
        });
    },
    drawCircle: function() {
        var a = this, t = this;
        wx.createSelectorQuery().select("#myCanvas").fields({
            node: !0,
            size: !0
        }).exec(function(n) {
            var e = n[0].node, r = e.getContext("2d");
            e.width = a.data.canWidth, e.height = a.data.canHeight;
            for (var o = [], c = 0; c < 30; c++) {
                var i = {
                    arcX: t.randow(0, t.data.canWidth),
                    arcY: t.randow(0, t.data.canHeight),
                    arcR: 3,
                    color: "rgba(255, 255, 255, 0.7)",
                    suduX: t.random(-.5, .5),
                    suduY: t.random(-.5, .5)
                };
                o.push(i);
            }
            setInterval(function() {
                r.clearRect(0, 0, a.data.canWidth, a.data.canHeight);
                for (var t = 0; t < 30; t++) {
                    o[t].arcX += o[t].suduX, o[t].arcY += o[t].suduY, r.beginPath(), r.fillStyle = o[t].color, 
                    r.arc(o[t].arcX, o[t].arcY, o[t].arcR, 0, 2 * Math.PI), r.fill(), r.closePath(), 
                    (o[t].arcX <= 0 || o[t].arcX > a.data.canWidth) && (o[t].suduX *= -1), (o[t].arcY <= 0 || o[t].arcY > a.data.canHeight) && (o[t].suduY *= -1);
                    for (var n = t + 1; n < 30; n++) Math.sqrt(Math.pow(o[t].arcX - o[n].arcX, 2) + Math.pow(o[t].arcY - o[n].arcY, 2)) < 70 && (r.beginPath(), 
                    r.strokeStyle = "rgba(255, 255, 255, 0.2)", r.moveTo(o[t].arcX, o[t].arcY), r.lineTo(o[n].arcX, o[n].arcY), 
                    r.closePath(), r.stroke());
                }
            }, 5);
        });
    },
    randow: function(a, t) {
        return Math.round(Math.random() * (a - t) + t);
    },
    random: function(a, t) {
        return Math.random() * (a - t) + t;
    },
    onReady: function() {
        this.drawCircle();
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});